package org.Raven.test;

import lombok.extern.slf4j.Slf4j;
import org.Raven.domain.activity.service.quota.RaffleActivityAccountQuotaService;
import org.Raven.infrastructure.persistent.dao.IRaffleActivityAccountMonthDao;
import org.Raven.infrastructure.persistent.po.RaffleActivityAccountMonth;
import org.Raven.infrastructure.persistent.redis.IRedisService;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.redisson.api.RMap;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import javax.annotation.Resource;

@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest
public class ApiTest {
    @Resource
    IRaffleActivityAccountMonthDao raffleActivityAccountMonthDao;
    @Resource
    RaffleActivityAccountQuotaService raffleActivityAccountQuotaService;
    @Resource
    private IRedisService redisService;
    @Test
    public void test() {
        RMap<Object, Object> map = redisService.getMap("strategy_id_100001");
        map.put(1,101);
        map.put(2,101);
        map.put(3,101);
        map.put(4,102);
        map.put(5,102);
        map.put(6,102);
        map.put(7,103);
        map.put(8,103);
        map.put(9,104);
        map.put(10,105);
        log.info("测试结果：{}",redisService.getFromMap("strategy_id_100001",10).toString());

    }

    @Test
    public void t(){
        Integer xiaofuge = raffleActivityAccountQuotaService.queryRaffleActivityAccountDayPartakeCount(100301L, "Raven");
        System.out.println("结果"+xiaofuge);
    }
    @Test
    public void t2(){
        RaffleActivityAccountMonth raffleActivityAccountMonth = raffleActivityAccountMonthDao.queryActivityAccountMonthByUserId(RaffleActivityAccountMonth.builder()
                .activityId(100301L)
                .userId("Raven")
                .build());
        log.info("结果是{}",raffleActivityAccountMonth);
    }

}
